﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Web.Script.Serialization;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
namespace MesForm.MES
{
    public class WCF_MES
    {
        //当前程序所在目录
        public static string BasePath = AppDomain.CurrentDomain.BaseDirectory;
        public static string Url = @"http://10.6.33.16:8007/wcfhttpservice?singleWsdl";
        //WcfHttpService.WsWcfServiceClient client = new WcfHttpService.WsWcfServiceClient(new System.ServiceModel.BasicHttpBinding(), new System.ServiceModel.EndpointAddress(Url));
        #region Old       
        private int _equId;
        /// <summary>
        /// 设备Id
        /// </summary>
        public int EquId
        {
            get { return _equId; }
            set { _equId = value; }
        }
        private string _equNo;
        /// <summary>
        /// 设备Id
        /// </summary>
        public string EquNo
        {
            get { return _equNo; }
            set { _equNo = value; }
        }

        private string _equName;
        /// <summary>
        /// 设备Id
        /// </summary>
        public string EquName
        {
            get { return _equName; }
            set { _equName = value; }
        }


        /*
        private string _savePath;
        /// <summary>
        /// 
        /// </summary>
        public string SavePath
        {
            get { return _savePath; }
            set { _savePath = value; }
        }
        */
        public static string SavePath = string.Empty;

        //public static List<MesParam> WSParamList;

        public static List<string> CodeDescList;



        /// <summary>
        /// 构造函数
        /// </summary>
        public WCF_MES()
        {
            InitMesLog();
            //CMesConnect();
        }
        /// <summary>
        /// MES连接
        /// </summary>
        //public void CMesConnect()
        //{
        //    MesParam mesParam = new MesParam();

        //}

        /// <summary>
        /// 
        /// </summary>
        private void InitMesLog()
        {
           
        }

        /// <summary>
        /// 保存MOM日志数据文件
        /// </summary>
        /// <param name="rtnDR"></param>
        //public void SaveMesOutLog(string commandID, string msg)
        //{
        //    string equipmentCode = GlobalDefine.ParamCfgCls.GetParamValue((int)ESysParamType.Customize, 2);
        //    _mesLog.BasePath = SavePath + commandID + "\\" + equipmentCode + "\\";
        //    MesLog.WriteLog(msg);
        //}

        public static string ClassToString<T>(T obj)
        {
            string jsonStr = new JavaScriptSerializer().Serialize(obj);
            return jsonStr;

        }
        #endregion
        private object lockobj = new object();


        //public object SendMOM(WcfHttpService.MessageRequest request)
        //{
        //    return client.SendMessage(request);
        //}
    }
}
